import { MockMethod } from 'vite-plugin-mock';
import { mock } from 'mockjs';
import { resultSuccess } from '../_util';

const cateList = mock({
  'data|30': [
    {
      id: '@increment',
      name: '@ctitle(6)',
      sort: '@integer(0,2)',
    },
  ],
});
const helpList = mock({
  'data|30': [
    {
      id: '@increment',
      title: '@ctitle(6)',
      cateId: '@integer(0,1)',
      cateName: '@ctitle(6)',
      sort: '@integer(0,2)',
      content: '@cparagraph(3)',
      createTime: '@date(yyyy-MM-dd HH:mm:ss)',
    },
  ],
});

export default [
  {
    url: '/mock-api/v1/shop/help/cate/list',
    method: 'post',
    response: () => {
      return resultSuccess({ list: cateList.data.slice(0, 6) });
    },
  },
  {
    url: '/mock-api/v1/shop/help/page',
    method: 'post',
    response: () => {
      return resultSuccess({ list: helpList.data.slice(0, 20), total: 20 });
    },
  },
] as MockMethod[];
